package com.example.mongodb_learn;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "person") //指定文档默认插入的集合
public class Student implements Serializable {
    private String name;
    private String className;
    private int age; //int类型默认会插入0

    //指定文档的主键ID，也就是_id  默认值是0
    @Id
    private int stuId;
}
